package com.hsd.computer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.naming.Name;

/**
 * 电脑
 */
@Component
public class Computer {

    String pp;//品牌
    @Resource(name="D1T")
    IDisk disk;//磁盘接口
    @Autowired
    IMemory memory;//内存接口

    public Computer() {
    }

    public Computer(IDisk disk, IMemory memory) {
        this.disk = disk;
        this.memory = memory;
    }

    public String getPp() {
        return pp;
    }

    public void setPp(String pp) {
        this.pp = pp;
    }

    public IDisk getDisk() {
        return disk;
    }

    public void setDisk(IDisk disk) {
        this.disk = disk;
    }

    public IMemory getMemory() {
        return memory;
    }

    public void setMemory(IMemory memory) {
        this.memory = memory;
    }

    /**
     * 显示当前电脑配置信息
     */
    public void computerInfo() {
        System.out.println("电脑配置：");
        System.out.println("品牌：" + pp);
        disk.diskInfo();
        memory.memoryInfo();
    }
}
